#include "watchdog.h"
#include "main.h"

void WDT_init(void)
{

  WDTC = WDT_COUNT_2_ms;//0xFFFFFFFF;//WDT_COUNT_10_ms;
  WDMOD = 1<<0 | 1<<1; 
  WDFEED = 0xAA;
  WDFEED = 0x55;
//  WDTC          
//  WDFEED        
//  WDTV 
}
void WDT_service(void)
{
  WDFEED = 0xAA;
  WDFEED = 0x55;
}
void WDT_service_15ms(void)
{
  static unsigned int timer = 0;
  if (++timer == 15)
  { 
    WDT_service();
    timer = 0;
  }
}
void WDT_service_5ms(void)
{
  static unsigned int timer = 0;
  if (++timer == 5)
  { 
    WDT_service();
    timer = 0;
  }
}
//void Timer_1msTask_helper_WDT(void)
//{
//  static unsigned int timer = 0;
// // WDT_service();
//  if (++timer == 1000)
//  {
////    buzzer(0);
//    timer = 0;
//    WDFEED = 0x00;
//  }
//}
